<?php

namespace plugin\admin\app\model;


/**
 * @property integer $id ID(主键)
 * @property string $username 用户名
 * @property string $nickname 昵称
 * @property string $password 密码
 * @property string $avatar 头像
 * @property string $email 邮箱
 * @property string $mobile 手机
 * @property string $created_at 创建时间
 * @property string $updated_at 更新时间
 * @property string $roles 角色
 */
class AdminThink extends BaseThink
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'wa_admins';
    protected $hidden = [];
    protected $validate=[
        'rule'=>[
            'nickname' => 'require'
        ],
        'msg'=>[
            'nickname.require'     => '昵称不能为空',
        ]
    ];
    public function roles(){
        return $this->belongsToMany(AdminRoleThink::class,'admin_access','role_id','admin_id');
    }
}
